openapi: 3.1.0 info: title: Agricultural federation API description: | # Versioning This API uses semantic versioning (MAJOR.MINOR.PATCH). Available versions are : - v0.0.1 (2026-04-21) : POST /collectivities for collectivities creation and POST /members for members creation. - v0.0.2 (2026-04-22) : PUT /collectivities/{id}/informations for collectivity information update. - v0.0.3 (2026-04-23) : New features about membership fees, collectivities transactions and its financial accounts, and members payments. - v0.0.4 (2026-04-23) : GET /collectivities/{id} and GET /collectivities/{id}/financialAccounts - v0.0.5 (2026-05-05) : Partial features collectivity statistics. - v0.0.6 (2026-05-05) : New features about collectivities activities and assiduity. - v0.0.7 (2026-05-05) : Adding assiduity data inside collectivity statistics. version: 0.0.7 servers: - url: 'http://localhost:8080' paths: '/collectivities': post: summary: Create list of collectivities description: | During collectivity request body creation, only members ID are provided to identify members. But the response content includes members information, not only their IDs. requestBody: content: application/json: schema: type: array items: $ref: '#/components/schemas/CreateCollectivity' responses: 201: description: List of created collectivities content: application/json: schema: type: array items: $ref: '#/components/schemas/Collectivity' 400: description: Collectivity without federation approval or structure missing. 404: description: Member not found. '/collectivities/{id}': get: summary: Retrieve collectivity by its ID. parameters: - in: path name: id schema: type: string required: true responses: 200: description: Collectivity retrieved content: application/json: schema: $ref: '#/components/schemas/Collectivity' 404: description: Collectivity not found '/collectivities/{id}/financialAccounts': get: summary: Get collectivity financial accounts parameters: - in: path name: id schema: type: string required: true - in: query name: at schema: type: string format: date responses: 200: description: List of financial account of the collectivity content: application/json: schema: type: array items: $ref: '#/components/schemas/FinancialAccount' 404: description: Collectivity not found '/collectivities/{id}/informations': put: summary: Attribute collectivity informations to specific collectivity parameters: - in: path name: id schema: type: string required: true requestBody: content: application/json: schema: $ref: '#/components/schemas/CollectivityInformation' responses: 200: description: Collectivity with updated information content: application/json: schema: $ref: '#/components/schemas/Collectivity' 400: description: Either given number or name is already used by other collectivity. 404: description: Collectivity not found. '/collectivities/{id}/membershipFees': get: summary: Retrieve collectivity membership fees parameters: - in: path name: id schema: type: string required: true responses: 200: description: List of membership fees for the specific collectivity content: application/json: schema: type: array items: $ref: '#/components/schemas/MembershipFee' 404: description: Collectivity not found. post: parameters: - in: path name: id schema: type: string required: true summary: Create new membership fees for a specific collectivity requestBody: content: application/json: schema: type: array items: $ref: '#/components/schemas/CreateMembershipFee' responses: 200: description: Created membership fees content: application/json: schema: type: array items: $ref: '#/components/schemas/MembershipFee' 400: description: Either unrecognized frequency or amount under 0. 404: description: Collectivity not found. '/collectivities/{id}/transactions': get: summary: Retrieve specific collectivity transactions for a given period description: | Query parameters `from` and `to` are mandatory to filters collectivity transactions. parameters: - in: path name: id schema: type: string required: true - in: query name: from schema: type: string format: date required: true - in: query name: to schema: type: string format: date required: true responses: 200: description: List of collectivity transactions between provided dates content: application/json: schema: type: array items: $ref: '#/components/schemas/CollectivityTransaction' 400: description: Provided query parameters occur some exceptions. 404: description: Collectivity not found. '/members': post: summary: Create list of members requestBody: content: application/json: schema: type: array items: $ref: '#/components/schemas/CreateMember' responses: 201: description: List of created members content: application/json: schema: type: array items: $ref: '#/components/schemas/Member' 400: description: | The following case must return a bad request exception : - Member with bad referees or without proper payment. - Membership dues not paid or registration fee not paid. 404: description: Either collectivity or member not found. '/members/{id}/payments': post: summary: Create some payments for given member description: | Each time a member create a payment, a transaction is store automatically inside collectivities transactions. parameters: - in: path name: id schema: type: string required: true requestBody: content: application/json: schema: type: array items: $ref: '#/components/schemas/CreateMemberPayment' responses: 201: description: List of created members payments content: application/json: schema: type: array items: $ref: '#/components/schemas/MemberPayment' '/collectivities/{id}/statistics': get: summary: Get local statistics for a collectivity description: | Get statistics for a collectivity between a date interval. Actually, statistics contain only earned amount from each member and potential unpaid amount. parameters: - in: path name: id schema: type: string required: true - in: query name: from schema: type: string format: date required: true - in: query name: to schema: type: string format: date required: true responses: 200: description: Collectivity local statistics content: application/json: schema: type: array items: $ref: '#/components/schemas/CollectivityLocalStatistics' 400: description: Mandatory query parameters not provided or malformed. 404: description: Collectivity not found '/collectivities/statistics': get: summary: Get collectivities overall statistics description: | Get collectivities global statistics between a date interval. Actually, statistics contain only overall percentage of members who are current with their dues (membership fees) and number of new members. parameters: - in: path name: id schema: type: string required: true - in: query name: from schema: type: string format: date required: true - in: query name: to schema: type: string format: date required: true responses: 200: description: Collectivity overall statistics content: application/json: schema: type: array items: $ref: '#/components/schemas/CollectivityOverallStatistics' '/collectivities/{id}/activities': get: summary: Retrieve existing collectivity activities parameters: - in: path name: id schema: type: string required: true responses: 200: description: List of collectivity activities content: application/json: schema: type: array items: $ref: '#/components/schemas/CollectivityActivity' 400: description: Mandatory query parameters not provided or malformed. 404: description: Collectivity not found post: summary: Add activities to specific collectivity description: | Note that either executive date or recurrence rule can be provided at same time, not both. parameters: - in: path name: id schema: type: string required: true requestBody: content: application/json: schema: type: array items: $ref: '#/components/schemas/CreateCollectivityActivity' responses: 200: description: List of added collectivity activities content: application/json: schema: type: array items: $ref: '#/components/schemas/CollectivityActivity' 400: description: Both recurrence rule and executive date provided, or provided data malformed inside payload. 404: description: Collectivities not found '/collectivities/{id}/activities/{activityId}/attendance': post: summary: Confirm members attendance to an existing collectivity activity description: | Note that a member attendance status (MISSING or ATTENDED) can not be updated once set. Only, UNDEFINED status can be then updated. parameters: - in: path name: id schema: type: string required: true - in: path name: activityId schema: type: string required: true requestBody: content: application/json: schema: type: array items: $ref: '#/components/schemas/CreateActivityMemberAttendance' responses: 201: description: List of activity member attendance created content: application/json: schema: type: array items: $ref: '#/components/schemas/ActivityMemberAttendance' 400: description: Either malformed provided data through request body or already confirmed attendance for any of provided member 404: description: Either collectivity not found or activity not found get: summary: Get members attendance to an existing collectivity activity description: | Note that return attendance must include UNDEFINED, ATTENDED or MISSING members. UNDEFINED and MISSING status are only set for members of the collectivity, that are concerned by their occupation set for the activity. For other members outside collectivity, they can only set ATTENDED status. Same for members inside collectivity, that are not concerned to be required to be present. parameters: - in: path name: id schema: type: string required: true - in: path name: activityId schema: type: string required: true responses: 201: description: List of activity member attendance including other members content: application/json: schema: type: array items: $ref: '#/components/schemas/ActivityMemberAttendance' 404: description: Either collectivity not found or activity not found components: schemas: ActivityMemberAttendance: type: object properties: id: type: string memberDescription: $ref: '#/components/schemas/MemberDescription' attendanceStatus: $ref: '#/components/schemas/AttendanceStatus' CreateActivityMemberAttendance: type: object properties: memberIdentifier: type: string attendanceStatus: $ref: '#/components/schemas/AttendanceStatus' AttendanceStatus: type: string enum: - MISSING - ATTENDED - UNDEFINED MonthlyRecurrenceRule: type: object properties: weekOrdinal: type: integer minimum: 1 maximum: 5 description: > Week position in a month. 1 = 1st week, 2 = 2nd week, … 5 = 5th week (if exists). dayOfWeek: type: string enum: [ MO, TU, WE, TH, FR, SA, SU ] description: Day of week. example: weekOrdinal: 3 dayOfWeek: SA # 3rd Saturday of each month CreateCollectivityActivity: type: object properties: label: type: string activityType: type: string enum: - MEETING - TRAINING - OTHER memberOccupationConcerned: type: array items: $ref: '#/components/schemas/MemberOccupation' recurrenceRule: $ref: '#/components/schemas/MonthlyRecurrenceRule' executiveDate: type: string format: date CollectivityActivity: allOf: - $ref: '#/components/schemas/CreateCollectivityActivity' properties: id: type: string CreateCollectivity: type: object properties: location: type: string members: type: array items: schema: $ref: '#/components/schemas/MemberIdentifier' federationApproval: type: boolean structure: $ref: '#/components/schemas/CreateCollectivityStructure' CreateCollectivityStructure: type: object properties: president: $ref: '#/components/schemas/MemberIdentifier' vicePresident: $ref: '#/components/schemas/MemberIdentifier' treasurer: $ref: '#/components/schemas/MemberIdentifier' secretary: $ref: '#/components/schemas/MemberIdentifier' CollectivityStructure: type: object properties: president: $ref: '#/components/schemas/Member' vicePresident: $ref: '#/components/schemas/Member' treasurer: $ref: '#/components/schemas/Member' secretary: $ref: '#/components/schemas/Member' CollectivityInformation: type: object properties: name: type: string number: type: int Collectivity: type: object allOf: - $ref: '#/components/schemas/CollectivityInformation' properties: id: type: string location: type: string structure: $ref: '#/components/schemas/CollectivityStructure' members: type: array items: $ref: '#/components/schemas/Member' CollectivityLocalStatistics: type: object properties: memberDescription: $ref: '#/components/schemas/MemberDescription' earnedAmount: type: number unpaidAmount: type: number assiduityPercentage: type: number CollectivityOverallStatistics: type: object properties: collectivityInformation: $ref: '#/components/schemas/CollectivityInformation' newMembersNumber: type: integer overallMemberCurrentDuePercentage: type: number overallMemberAssiduityPercentage: type: number MemberIdentifier: type: string CreateMember: type: object allOf: - $ref: '#/components/schemas/MemberInformation' properties: collectivityIdentifier: type: string referees: type: array items: $ref: '#/components/schemas/MemberIdentifier' registrationFeePaid: type: boolean membershipDuesPaid: type: boolean MemberDescription: type: object properties: id: type: string firstName: type: string lastName: type: string email: type: string occupation: type: string MemberInformation: type: object properties: firstName: type: string lastName: type: string birthDate: type: string format: date gender: $ref: '#/components/schemas/Gender' address: type: string profession: type: string phoneNumber: type: int email: type: string occupation: $ref: '#/components/schemas/MemberOccupation' Member: type: object allOf: - $ref: '#/components/schemas/MemberInformation' properties: id: $ref: '#/components/schemas/MemberIdentifier' referees: type: array items: $ref: '#/components/schemas/Member' CreateMembershipFee: type: object properties: eligibleFrom: type: string format: date frequency: $ref: '#/components/schemas/Frequency' amount: type: number label: type: string MembershipFee: allOf: - $ref: '#/components/schemas/CreateMembershipFee' type: object properties: id: type: string status: $ref: '#/components/schemas/ActivityStatus' CreateMemberPayment: type: object properties: amount: type: int membershipFeeIdentifier: type: string accountCreditedIdentifier: type: string paymentMode: $ref: '#/components/schemas/PaymentMode' MemberPayment: properties: id: type: string amount: type: int paymentMode: $ref: '#/components/schemas/PaymentMode' accountCredited: $ref: '#/components/schemas/FinancialAccount' creationDate: type: string format: date FinancialAccount: oneOf: - $ref: '#/components/schemas/CashAccount' - $ref: '#/components/schemas/MobileBankingAccount' - $ref: '#/components/schemas/BankAccount' CashAccount: type: object properties: id: type: string amount: type: int MobileBankingAccount: type: object properties: id: type: string holderName: type: string mobileBankingService: $ref: '#/components/schemas/MobileBankingService' mobileNumber: type: int amount: type: number BankAccount: type: object properties: id: type: string holderName: type: string bankName: $ref: '#/components/schemas/Bank' bankCode: type: int bankBranchCode: type: int bankAccountNumber: type: int bankAccountKey: type: int amount: type: number MobileBankingService: type: string enum: - AIRTEL_MONEY - MVOLA - ORANGE_MONEY CollectivityTransaction: type: object properties: id: type: string creationDate: type: string format: date amount: type: number paymentMode: $ref: '#/components/schemas/PaymentMode' accountCredited: $ref: '#/components/schemas/FinancialAccount' memberDebited: $ref: '#/components/schemas/Member' Bank: type: string enum: - BRED - MCB - BMOI - BOA - BGFI - AFG - ACCES_BAQUE - BAOBAB - SIPEM Gender: type: string enum: - MALE - FEMALE MemberOccupation: type: string enum: - JUNIOR - SENIOR - SECRETARY - TREASURER - VICE_PRESIDENT - PRESIDENT Frequency: type: string enum: - WEEKLY - MONTHLY - ANNUALLY - PUNCTUALLY ActivityStatus: type: string enum: - ACTIVE - INACTIVE PaymentMode: type: string enum: - CASH - MOBILE_BANKING - BANK_TRANSFER